<?php
   include("connectionParameters.php");
   
         $connection = mysql_connect($host,$user,$pass)
		or die ("Can't connect to server, try again later, please.");

	mysql_select_db($database);
   
// show all books by default
	$query = "select Books.BookId, Books.Title, Books.Author, Books.ISBN, Books.Edition, Books.Course, Books.Professor, Books.Location, Books.Price, Books.PostDate from Books, Hits where Books.BookId=Hits.BookId order by Hits.HitCount desc limit 3;";
	$result = mysql_query($query,$connection)
		or die ("Problem with reading data from database, try again later.");
		while( $row = mysql_fetch_row($result )){
			// get data from database
			$bookId = $row[0];
			$title = $row[1];
			$author = $row[2];
			$isbn = $row[3];
			$edition = $row[4];
			$course = $row[5];
			$professor = $row[6];
			$location = $row[7];
			$price = $row[8];
			$postDate = $row[9];
	
			echo "$bookId <br />";
			echo "$title <br />";
			echo "$author <br />";
			echo "$isbn <br />";
					
			$row2 = mysql_fetch_row($result);
			
			$bookId2 = $row2[0];
			$title2 = $row2[1];
			$author2 = $row2[2];
			$isbn2 = $row2[3];
			
			echo "$bookId2 <br />";
			echo "$title2 <br />";
			echo "$author2 <br />";
			echo "$isbn2 <br />";
			
			
						  
			 }
			
			mysql_close($connection);
			?>